// 用户地址信息
import {reqgetUserAddressList,reqgetTradeList} from '@/api'

const state={
  userAddressList:[],
  tradeList:{}
}

const mutations={
// 用户地址信息
  GETUSERADDRESSLIST(state,data){
    state.userAddressList = data
  },
// 订单列表
  GETTRADELIST(state,data){
    state.tradeList = data
  }
}

const actions={
  // 用户地址信息
  async getUserAddressList({commit}){
    const res = await reqgetUserAddressList()
    if(res.code === 200){
      commit('GETUSERADDRESSLIST',res.data)
    }
    
  },
  // 订单列表
  async getTradeList({commit}){
    const res = await reqgetTradeList()
    if(res.code === 200){
      commit('GETTRADELIST',res.data)
    }
  }
}

const getters={

}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}